package com.example.springcloudnacosconfig.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.concurrent.TimeUnit;

@Api(value = "test FlowLimitController")
@RestController
@Slf4j
public class FlowLimitController {

    @ApiOperation(value = "测试方法testA ", notes = "testA")
    @GetMapping(value = "testA")
    public String testA(){
        return "into testA ------------------";
    }

    @GetMapping(value = "testB")
    public String testB(){
        return "into testB ------------------";
    }

    @GetMapping(value = "testC")
    public String testC(){

        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("into" +System.currentTimeMillis());
        return "into testC ------------------";
    }

    /**
     * @ClassName FlowLimitController
     * @Description : 功能说明 swagger接口配置添加测试
     * @Param:
     * @Return :
     * @Author : zyy
     * @Date : 2020/9/8 17:03
    */
    @GetMapping(value = "testD")
  /* @ApiImplicitParams({
            @ApiImplicitParam(name="p1",value = "第一个参数可以填写或不填写",required = false,paramType="form"),
            @ApiImplicitParam(name="p2",value = "第二个参数可以填写或不填写",required = false,paramType="form")
    })*/
    public String testD(@RequestParam (value = "p1" ,required = false) String p1,
                        @RequestParam (value = "p2" ,required = false) String p2){

        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.info("into" +System.currentTimeMillis()+"::"+p1);
        System.out.println("into" +System.currentTimeMillis()+"::"+p1);
        return "into testC ------------------:p1=:"+p1+":p2=:"+p2;
    }
}
